<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="header.jsp" />      
    <div id="inner_wrap">
	<div id="inner_hold">
	<div id="inner">
	<div class="center_hold">
        <jsp:useBean id="employeeManagement" class="com.aal.model.EmployeeManagement">
            <c:set target="${employeeManagement}" property="username" value="${param.username}"/>
            <c:set target="${employeeManagement}" property="password" value="${param.password}"/>
            <c:set target="${employeeManagement}" property="firstname" value="${param.firstname}"/>
            <c:set target="${employeeManagement}" property="lastname" value="${param.lastname}"/>
            <c:set target="${employeeManagement}" property="email" value="${param.email}"/>
            <c:set target="${employeeManagement}" property="phone" value="${param.phone}"/>
            <c:set var="hidden" value="${param.hidden}"/>
        </jsp:useBean>
        <c:choose>
            <c:when test="${param.gg == 'male'}">
                <c:set target="${employeeManagement}" property="gender" value ="${true}"/>
            </c:when>
            <c:when test="${param.gg == 'female'}">
                <c:set target="${employeeManagement}" property="gender" value="${false}"/>
            </c:when>
        </c:choose>
        <c:if test="${!empty param.username && param.hidden == 'create' }">
            <jsp:getProperty name="employeeManagement" property="createuser"/>
        </c:if>
        <c:if test="${!empty param.username && param.hidden == 'edit'}">
            <jsp:getProperty name="employeeManagement" property="edituser"/>
        </c:if>
        <form>
         <fieldset>
                <legend>employee management</legend>
                <input type="hidden" name="hidden" value="create"/>
                <label for="username">username:</label>
                <input type="text" name="username" required placeholder="Inser username"/></br>
                <label for="password">password:</label>
                <input type="password" name="password" required placeholder="Insert password"/></br>
                <label for="firstname">firstname:</label>
                <input type="text" name="firstname" required placeholder="Insert firstname"/></br>
                <label for="lastname">lastname:</label>
                <input type="text" name="lastname" required placeholder="Insert lastname"/></br>
                <label for="email">email</label>
                <input type="email" name="email" required placeholder="Insert email"/></br>
                <label for="phone">phone:</label>
                <input type="text" name="phone" required placeholder="Insert phone"/></br>
                <label for="gender">gender</label>
                <select name="gg">
                    <option value="male">male</option>
                    <option value="female">female</option>
                </select>
                
                <input type="submit" value="create employee"/>
         </fieldset>
        </form>
        <form>
         <fieldset>
                <legend>employee management</legend>
                <input type="hidden" name="hidden" value="edit"/>
                <label for="username">username:</label>
                <input type="text" name="username" required placeholder="Inser username"/></br>
                <label for="password">password:</label>
                <input type="password" name="password" required placeholder="Insert password"/></br>
                <label for="firstname">firstname:</label>
                <input type="text" name="firstname" required placeholder="Insert firstname"/></br>
                <label for="lastname">lastname:</label>
                <input type="text" name="lastname" required placeholder="Insert lastname"/></br>
                <label for="email">email</label>
                <input type="email" name="email" required placeholder="Insert email"/></br>
                <label for="phone">phone:</label>
                <input type="text" name="phone" required placeholder="Insert phone"/></br>
                <label for="gender">gender</label>
                <select name="gg">
                    <option value="male">male</option>
                    <option value="female">female</option>
                </select>
                
                <input type="submit" value="edit employee"/>
         </fieldset>
        </form>
        <form>
            <fieldset>
                <legend>employee management</legend>
                <input type="hidden" name="hidden" value="view"/>               
                <label for="username">username:</labe>
                <input type="text" name="username" required placeholder="Insert username"/></br>
                <input type="submit" value="Search by username"/>      
            </fieldset>
        </form>
        <c:if test="${!empty param.username && param.hidden=='view'}">
            <table class="bordered">
                <c:forEach items="${employeeManagement.searchemployee}" var="item">
                <tr><td><c:out value="${item.username}"/></td><td><c:out value="${item.firstname}"/></td>
                    <td><c:out value="${item.lastname}"/></td><td><c:out value="${item.email}"/></td>
                    <td><c:out value="${item.phone}"/></td>
                </tr>
            </c:forEach>
            </table>
        </c:if>
   </div>
	</div>
	</div>
	</div>
<jsp:include page="footer.jsp" />
